package com.lanmaoly.cunzheng;

/**
 * 策略模式测试
 *
 * @author
 */
public class DuckTest {

    static int a = 0, b = 0;
    static int x;
    static int y;

    public static void main(String[] args) {
        /*Duck duck = new YellowDuck();
        duck.dispaly();
        duck.setFlyBehavior(new FlyRocket());
        duck.performFly();
        duck.performQuack();
        duck.swim();*/
        for (int i = 0; i < 10; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    a = 1;
                    System.out.println("1");
                    x = b;
                }
            }).start();

            new Thread(new Runnable() {
                @Override
                public void run() {
                    b = 2;
                    System.out.println(2);
                    y = a;
                }
            }).start();

            System.out.println("x:" + x);
            System.out.println("y:" + y);
        }
    }

}
